package org.eminem.spring.cloud.finchley.service;

import org.eminem.spring.cloud.finchley.config.HelloFeignServiceConfig;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestParam;

@FeignClient(name = "github-client", url = "https://api.github.com", configuration = HelloFeignServiceConfig.class)
public interface HelloFeignService {

    /**
     * content: {"message":"Validation Failed","errors":[{"resource":"Search","field":"q","code":"missing"}],
     * "documentation_url":"https://developer.github.com/v3/search"}
     * @param queryStr
     * @return
     */
    @GetMapping(value = "/search/repositories")
    ResponseEntity<byte[]> searchRepo(@RequestParam("q") String queryStr);

    @GetMapping(value = "/search/repositories")
    String searchStringRepo(@RequestParam("q") String queryStr);

}
